<%-- 
    Document   : capnhatsanpham
    Created on : Jan 6, 2012, 12:01:01 PM
    Author     : HoangLiem
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<link href="style/register.css" rel="stylesheet" type="text/css"/>

<div id="insertproduct_body_main">
    <div class="bar">CẬP NHẬT SẢN PHẨM</div>
    <form id="frmThemSanPham" name="frmThemSanPham" action="capNhatSanPham" method="post">
        <div id="register">
            <div class="subbar">Cập nhật các thông tin sau</div>
            <c:choose>
                <c:when test="${kq == true}">
                    <div class="dk_detail" id="dtMaSanPham">
                        <div class="dkitem"></div>
                        <div class="dkitem_textbox">
                            <p>
                                CẬP NHẬT SẢN PHẨM THÀNH CÔNG
                            </p>
                            <p></p>
                        </div>
                    </div>
                </c:when>
                <c:otherwise>
                </c:otherwise>
            </c:choose>
            <input type="hidden" name="maSanPham" value="${sanPham.maSanPham}"/>
            <input type="hidden" name="tinhTrang" value="${sanPham.tinhTrang}"/>
            <input type="hidden" name="trangThai" value="${sanPham.trangThai}"/>
            <div class="dk_detail" id="dtTenSanPham">
                <div class="dkitem">Tên sản phẩm :</div>
                <div class="dkitem_textbox">
                    <p>
                        <input type="text" name="tenSanPham" id="tenSanPham" value="${sanPham.tenSanPham}" class="dk_textbox" />
                    </p>
                </div>
            </div>
            <div class="horizontal"><hr/></div>
            <div class="dk_detail" id="dtGiaKhoiDiem">
                <div class="dkitem">Giá khởi điểm :</div>
                <div class="dkitem_textbox">
                    <p>
                        <input type="text" name="giaKhoiDiem" id="giaKhoiDiem" value="${sanPham.giaKhoiDiem}" class="dk_textbox" />
                    </p>
                    <p>Nhập vào giá khởi điểm, lưu ý đơn vị tiền là 1000VNĐ</p>
                </div>
            </div>
            <div class="horizontal"><hr/></div>
            <div class="dk_detail" id="dtGiaBanLien">
                <div class="dkitem">Giá bán liền :</div>
                <div class="dkitem_textbox">
                    <p>
                        <input type="text" name="giaBanLien" id="giaBanLien" value="${sanPham.giaBanLien}" class="dk_textbox" />
                    </p>
                </div>
            </div>
            <div class="horizontal"><hr/></div>
            <div class="dk_detail" id="dtNgayBatDau">
                <div class="dkitem">Ngày bắt đầu:</div>
                <div class="dkitem_textbox">
                    <div class="ngaySinhItem">
                        <p>Tháng:</p>
                        <p>
                            <select name="thangNBD" id="thangNBD" style="width: 80px;">
                                <c:forEach items="${dsThang}" var="m1" varStatus="dsThang" begin="0" end="${dsThang.size()}" step="1"> 
                                    <option 
                                        <c:set var="m" value="${sanPham.getThoiDiemBatDau().getMonth()+1}"/>
                                        <c:if test="${m == m1}">
                                            selected = 'selected' 
                                        </c:if>
                                        value='${m1}'>Tháng ${m1}
                                    </option>
                                </c:forEach>
                            </select>
                        </p>
                    </div>
                    <div class="ngaySinhItem">
                        <p>Ngày:</p>
                        <p>
                            <select name="ngayNBD" id="ngayNBD" style="width: 50px;">
                                <c:forEach items="${dsNgay}" var="d1" varStatus="dsNgay" begin="0" end="${dsNgay.size()}" step="1"> 
                                    <option 

                                        <c:set var="d" value="${sanPham.getThoiDiemBatDau().getDate()}" scope="page" />
                                        <c:if test="${d == d1}">
                                            selected = 'selected' 
                                        </c:if>
                                        value='${d1}'>${d1}
                                    </option>
                                </c:forEach>
                            </select>
                        </p>
                    </div>
                    <div class="ngaySinhItem">
                        <p>Năm:</p>
                        <p>
                            <select name="namNBD" id="namNBD" style="width: 80px;">
                                <c:forEach items="${dsNam}" var="y1" varStatus="dsNam" begin="0" end="${dsNam.size()}" step="1"> 
                                    <option                  
                                        <c:set var="y" value="${sanPham.getThoiDiemBatDau().getYear()+1900}" scope="page" />
                                        <c:if test="${y == y1}">
                                            selected = 'selected' 
                                        </c:if>

                                        value='${y1}'>${y1}
                                    </option>
                                </c:forEach>
                            </select>
                        </p>
                    </div>
                    <div class="ngaySinhItem">
                        <p>Giờ :</p>
                        <p>
                            <select name="gioNBD" id="gioNBD" style="width: 80px;">
                                <c:forEach items="${dsGio}" var="h1" varStatus="dsGio" begin="0" end="${dsGio.size()}" step="1"> 
                                    <option 

                                        <c:set var="h" value="${sanPham.getThoiDiemBatDau().getHours()}" scope="page" />
                                        <c:if test="${h == h1}">
                                            selected = 'selected' 
                                        </c:if>
                                        value='${h1}'>${h1}
                                    </option>
                                </c:forEach>
                            </select>
                        </p>
                    </div>
                    <div class="ngaySinhItem">
                        <p>Phút :</p>
                        <p>
                            <select name="phutNBD" id="phutNBD" style="width: 80px;">
                                <c:forEach items="${dsPhut}" var="mn1" varStatus="dsPhut" begin="0" end="${dsPhut.size()}" step="1"> 
                                    <option 

                                        <c:set var="mn" value="${sanPham.getThoiDiemBatDau().getMinutes()}" scope="page" />
                                        <c:if test="${mn == mn1}">
                                            selected = 'selected' 
                                        </c:if>
                                        value='${mn1}'>${mn1}
                                    </option>
                                </c:forEach>
                            </select>
                        </p>
                    </div>
                </div>
            </div>
            <div class="horizontal"><hr/></div>
            <div class="dk_detail" id="dtNgayKetThuc">
                <div class="dkitem">Ngày kết thúc:</div>
                <div class="dkitem_textbox">
                    <div class="ngaySinhItem">
                        <p>Tháng:</p>
                        <p>
                            <select name="thangNKT" id="thangNKT" style="width: 80px;">
                                <c:forEach items="${dsThang}" var="m2" varStatus="dsThang" begin="0" end="${dsThang.size()}" step="1"> 
                                    <option 

                                        <c:set var="m" value="${sanPham.getThoiDiemKetThuc().getMonth()+1}" />
                                        <c:if test="${m == m2}">
                                            selected = 'selected' 
                                        </c:if>

                                        value='${m2}'>Tháng ${m2}
                                    </option>
                                </c:forEach>
                            </select>
                        </p>
                    </div>
                    <div class="ngaySinhItem">
                        <p>Ngày:</p>
                        <p>
                            <select name="ngayNKT" id="ngayNKT" style="width: 50px;">
                                <c:forEach items="${dsNgay}" var="d2" varStatus="dsNgay" begin="0" end="${dsNgay.size()}" step="1"> 
                                    <option 

                                        <c:set var="d" value="${sanPham.getThoiDiemKetThuc().getDate()+1}" />
                                        <c:if test="${d == d2}">
                                            selected = 'selected' 
                                        </c:if>

                                        value='${d2}'>${d2}
                                    </option>
                                </c:forEach>
                            </select>
                        </p>
                    </div>
                    <div class="ngaySinhItem">
                        <p>Năm:</p>
                        <p>
                            <select name="namNKT" id="namNKT" style="width: 80px;">
                                <c:forEach items="${dsNam}" var="y2" varStatus="dsNam" begin="0" end="${dsNam.size()}" step="1"> 
                                    <option 

                                        <c:set var="y" value="${sanPham.getThoiDiemKetThuc().getYear()+1900}" />
                                        <c:if test="${y == y2}">
                                            selected = 'selected' 
                                        </c:if>

                                        value='${y2}'>${y2}
                                    </option>
                                </c:forEach>
                            </select>
                        </p>
                    </div>
                    <div class="ngaySinhItem">
                        <p>Giờ :</p>
                        <p>
                            <select name="gioNKT" id="gioNKT" style="width: 80px;">
                                <c:forEach items="${dsGio}" var="h2" varStatus="dsGio" begin="0" end="${dsGio.size()}" step="1"> 
                                    <option 

                                        <c:set var="h" value="${sanPham.getThoiDiemKetThuc().getHours()}" />
                                        <c:if test="${h == h2}">
                                            selected = 'selected' 
                                        </c:if>

                                        value='${h2}'>${h2}
                                    </option>
                                </c:forEach>
                            </select>
                        </p>
                    </div>
                    <div class="ngaySinhItem">
                        <p>Phút :</p>
                        <p>
                            <select name="phutNKT" id="phutNKT" style="width: 80px;">
                                <c:forEach items="${dsPhut}" var="mn2" varStatus="dsPhut" begin="0" end="${dsPhut.size()}" step="1"> 
                                    <option 

                                        <c:set var="mn" value="${sanPham.getThoiDiemKetThuc().getMinutes()}" />
                                        <c:if test="${mn == mn2}">
                                            selected = 'selected' 
                                        </c:if>

                                        value='${mn2}'>${mn2}
                                    </option>
                                </c:forEach>
                            </select>
                        </p>
                    </div>
                </div>
            </div>
            <div class="horizontal"><hr/></div>
            <div class="dk_detail" id="dtDanhMuc">
                <div class="dkitem">Danh mục :</div>
                <div class="dkitem_textbox">
                    <p>
                        <select name="maDanhMuc" id="maDanhMuc" class="dk_select">
                            <option value="-1" selected="selected">--Chọn danh mục--</option>
                            <c:forEach  items="${dsDanhMuc}" var="dm" varStatus="dsDanhMuc" begin="0" end="${dsDanhMuc.size()}" step="1"> 
                                <option 
                                    
                                        <c:set var="mdm" value="${sanPham.getDanhmucNhasanxuat().getDanhmuc().getMaDanhMuc()}" scope="page" />
                                        <c:if test="${mdm == dm.maDanhMuc}">
                                            selected = 'selected' 
                                        </c:if>
                                    
                                    value='${dm.maDanhMuc}'>${dm.tenDanhMuc}
                                </option>
                            </c:forEach>
                        </select>
                    </p>
                </div>
            </div>
            <div class="horizontal"><hr/></div>
            <div class="dk_detail" id="dtNhaSanXuat">
                <div class="dkitem">Nhà sản xuất :</div>
                <div class="dkitem_textbox">
                    <p>
                        <select name="maNhaSanXuat" id="maNhaSanXuat" class="dk_select">
                            <option value="-1" selected="selected">--Chọn nhà sản xuất--</option>
                            <c:forEach  items="${dsNhaSanXuat}" var="nsx" varStatus="dsNhaSanXuat" begin="0" end="${dsNhaSanXuat.size()}" step="1"> 
                                <option 
                                   
                                        <c:set var="mNsx" value="${sanPham.getDanhmucNhasanxuat().getNhasanxuat().getMaNhaSanXuat()}" scope="page" />
                                        <c:if test="${mNsx == nsx.maNhaSanXuat}">
                                            selected = 'selected' 
                                        </c:if>
                                    
                                    value='${nsx.maNhaSanXuat}'>${nsx.tenNhaSanXuat}
                                </option>
                            </c:forEach>
                        </select>
                    </p>
                </div>
            </div>
            <div class="horizontal"><hr/></div>
            <div class="dk_detail" id="dtLoaiDauGia">
                <div class="dkitem">Loai đấu giá :</div>
                <div class="dkitem_textbox">
                    <p>
                        <select name="maLoaiDauGia" id="maLoaiDauGia" class="dk_select">
                            <option value="-1" selected="selected">--Chọn loại đấu giá--</option>
                            <c:forEach  items="${dsLoaiDauGia}" var="ldg" varStatus="dsLoaiDauGia" begin="0" end="${dsLoaiDauGia.size()}" step="1"> 
                                <option 
                                    
                                        <c:set var="mLdg" value="${sanPham.loaidaugia.maLoaiDauGia}" scope="page" />
                                        <c:if test="${mLdg == ldg.maLoaiDauGia}">
                                            selected = 'selected' 
                                        </c:if>
                                    
                                    value='${ldg.maLoaiDauGia}'>${ldg.tenLoaiDauGia}
                                </option>
                            </c:forEach>
                        </select>
                    </p>
                </div>
            </div>

            <div class="horizontal"><hr/></div>
            <div class="dk_detail" id="dtMoTa">
                <div class="dkitem">Mô tả :</div>
                <div class="dkitem_editor">
                    <p>
                        <script src="editor/ckeditor.js" language="javascript"></script>
                    <style>
                        input,textarea{margin:1px;}
                    </style>
                    <div style="float:left;width:100%;padding:1px;">
                        <table border="0" cellpadding="0" cellspacing="0" align="center">                                       
                            <tr>
                                <td><textarea name="moTa" id="txtnoidung"  rows="10" cols="20">${sanPham.moTa}</textarea></td>
                            </tr>
                            <script type="text/javascript" language="javascript">
                                CKEDITOR.replace( 'txtnoidung' );
                            </script>  
                        </table>                
                    </div>
                    </p>
                </div>
            </div>
            <div class="horizontal"><hr/></div>
            <div class="subbar">Hoàn tất</div>
            <div class="dk_detail" id="dtHoanTat">
                <input type="submit" name="them" id="them" value="Cập nhật" onclick="return ktupload();"/>
            </div>
        </div>
                            
    </form>
</div>
